//
//  LZRestaurantAuthLicenseCell.m
//  laziz_Merchant
//
//  Created by xbnzd on 17/3/3.
//  Copyright © 2017年 XBN. All rights reserved.
//

#import "LZRestaurantAuthLicenseCell.h"
#import "UIImageView+WebCache.h"

@interface LZRestaurantAuthLicenseCell()
@property (weak, nonatomic) IBOutlet UILabel *cellNameLabel;
@property (weak, nonatomic) IBOutlet UIImageView *licenseImgView;

@end

@implementation LZRestaurantAuthLicenseCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.cellNameLabel.text = LZLocalizedString(@"business_lic", nil);
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickImgAction)];
    self.licenseImgView.userInteractionEnabled = YES;
    [self.licenseImgView addGestureRecognizer:tap];
    
    self.licenseImgView.layer.cornerRadius = 4;
    self.licenseImgView.layer.borderColor = UIColorFromRGB(0xcccccc, 1).CGColor;
    self.licenseImgView.layer.borderWidth = 0.5;
    self.licenseImgView.layer.masksToBounds = YES;
}

#pragma mark -
#pragma mark load data
- (void)loadLicenseImgWithURL:(NSString *)imgURL
{
    if (imgURL.length == 0) {
        self.licenseImgView.image = [UIImage imageNamed:@"res_add_license"];
    }
    [self.licenseImgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",APIBaseImageUrl,imgURL]] placeholderImage:[UIImage imageNamed:@"res_add_license"]];
}


/**
 是否允许编辑

 @param enable <#enable description#>
 */
- (void)changeCellEnable:(BOOL)enable
{
    self.licenseImgView.userInteractionEnabled = enable;
}

#pragma mark -
#pragma mark event
- (void)clickImgAction
{
    if (self.restaurantAuthLicenseCellDelegate && [self.restaurantAuthLicenseCellDelegate respondsToSelector:@selector(clickLicenseImageViewAction)]) {
        [self.restaurantAuthLicenseCellDelegate clickLicenseImageViewAction];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
